package ee.videorentalstore.protocols.commands.changingsystemusercommands;

import ee.videorentalstore.protocols.commands.Command;
import ee.videorentalstore.users.User;
import ee.videorentalstore.users.UsersDatabase;

public class GetListOfAllUsersCommand extends Command
{
	@Override
	public String getCommandDescription() 
	{
		return "GET LIST OF ALL USERS";
	}
	
	
	@Override
	public void executeCommand(String inputStreamInstructionsToProcess)
	{
		if (!UsersDatabase.getInstance().getAllUsers().isEmpty())
		{
			for (User user : UsersDatabase.getInstance().getAllUsers())
			{
				System.out.println("User ID: " + user.getUserID() + "\n" +
								   "User name: " + user.getUserName() + "\n" +
								   "User type: " + user.getUserTypeName());
				System.out.println();
			}
		}
		else
		{
			System.err.println("There is no user registered, but there has to be " +
					"a default user, employee - Film manager");
		}
	}
}
